package com.aaa.work1226.entity.vo;

import java.util.List;

public class ResponseMode<T> {
    private Integer code;

    private String msg;

    private List<T> data;

    private Object extra;

    public Object getExtra() {
        return extra;
    }

    public ResponseMode<T> setExtra(Object extra) {
        this.extra = extra;
        return this;
    }

    public ResponseMode() {
    }

    public ResponseMode(Integer code, String msg, List<T> data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public ResponseMode setCode(Integer code) {
        this.code = code;
        return  this;
    }

    public String getMsg() {
        return msg;
    }

    public ResponseMode setMsg(String msg) {
        this.msg = msg;
        return  this;
    }

    public List<T> getData() {
        return data;
    }

    public ResponseMode setData(List<T> data) {
        this.data = data;
        return  this;
    }

    public static ResponseMode success(){
        ResponseMode responseModel=new ResponseMode<>();
        responseModel.setCode(0);
        responseModel.setMsg("success");
        return responseModel;
    }

    public static ResponseMode error(){
        ResponseMode responseModel=new ResponseMode();
        responseModel.setCode(1);
        responseModel.setMsg("error");
        return responseModel;
    }
}
